<?php
namespace Admin\Api;

use Admin\Common\Controller;
use Portal\Domain\Admin as AdminDomain;

class Examples extends Controller {

    /**
     * Widgets组件
     */
    public function widgets() {
        return $this->render('examples/widgets.html');
    }

    /**
     * OSS文件上传
     */
    public function upload() {
        $url = '';
        if (!empty($_FILES['file'])) {
            $rs = \PhalApi\DI()->oss->upload($_FILES['file']);
            $url = isset($rs['url']) ? $rs['url'] : $url;
        }

        $data = array('url' => $url);

        return $this->render('examples/upload.html', $data);
    }

    /**
     * UI 元素-常规
     */
    public function pagesUIGeneral() {
        return $this->render('examples/pagesUIGeneral.html');
    }

    /**
     * UI 元素-图标
     */
    public function pagesUIIcons() {
        return $this->render('examples/pagesUIIcons.html');
    }

    /**
     * UI 元素-按钮
     */
    public function pagesUIButtons() {
        return $this->render('examples/pagesUIButtons.html');
    }

    /**
     * UI 元素-滑块
     */
    public function pagesUISliders() {
        return $this->render('examples/pagesUISliders.html');
    }

    /**
     * UI 元素-弹框 & 提醒
     */
    public function pagesUIModals() {
        return $this->render('examples/pagesUIModals.html');
    }

    /**
     * UI 元素-导航 & 选项卡
     */
    public function pagesUINavbar() {
        return $this->render('examples/pagesUINavbar.html');
    }

    /**
     * UI 元素-时间线
     */
    public function pagesUITimeline() {
        return $this->render('examples/pagesUITimeline.html');
    }

    /**
     * UI 元素-丝带
     */
    public function pagesUIRibbons() {
        return $this->render('examples/pagesUIRibbons.html');
    }

    /**
     * 表单-OSS文件上传
     */
    public function pagesFormsGeneral() {
        return $this->render('examples/pagesFormsGeneral.html');
    }

    /**
     * 表单-高级表单
     */
    public function pagesFormsAdvanced() {
        return $this->render('examples/pagesFormsAdvanced.html');
    }

    /**
     * 表单-编辑器
     */
    public function pagesFormsEditors() {
        return $this->render('examples/pagesFormsEditors.html');
    }

    /**
     * 表单-验证
     */
    public function pagesFormsValidation() {
        return $this->render('examples/pagesFormsValidation.html');
    }

    /**
     * 表格-简单表格
     */
    public function pagesTablesSimple() {
        return $this->render('examples/pagesTablesSimple.html');
    }

    /**
     * 表格-数据表格
     */
    public function pagesTablesData() {
        return $this->render('examples/pagesTablesData.html');
    }

    /**
     * 表格-jsGrid 插件
     */
    public function pagesTablesJsgrid() {
        return $this->render('examples/pagesTablesJsgrid.html');
    }

    /**
     * 示例-日历
     */
    public function pagesCalendar() {
        return $this->render('examples/pagesCalendar.html');
    }

    /**
     * 示例-相册
     */
    public function pagesGallery() {
        return $this->render('examples/pagesGallery.html');
    }

    /**
     * 附加-404 错误
     */
    public function pages400() {
        return $this->render('examples/pages400.html');
    }

    /**
     * 附加-500 错误
     */
    public function pages500() {
        return $this->render('examples/pages500.html');
    }

    /**
     * 附加-加载状态
     */
    public function pagesPace() {
        return $this->render('examples/pagesPace.html');
    }

    /**
     * 附加-空白页
     */
    public function pagesBlank() {
        return $this->render('examples/pagesBlank.html');
    }

    /**
     * 附加-起始页
     */
    public function pagesStarter() {
        return $this->render('examples/pagesStarter.html');
    }

    public function forbidden() {
        echo '你应该看不到我';
    }
}
